#ifndef CLIENT_H_H
#define CLIENT_H_H

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>

#define R 1 //注册
#define L 2 //登录
#define S 3 //查询
#define H 4 //历史

#define ERRLOG(errmsg) do{\
                                                            perror(errmsg);\
                                                            printf("file:%s,func:%s,line:%d\n",__FILE__,__func__,__LINE__);\
                                                            exit(-1);\
                                                            }while(0);

typedef struct{
    int type;
    char name[32];
    char pass[32];
    char text[256];
}MSG;

void play_client();

void do_register(int sockfd,MSG* msg);

int do_login(int sockfd,MSG* msg);

void do_next_login(int sockfd,MSG* msg);

void play_next_client();

void do_select(int sockfd,MSG* msg);
                   
void do_history(int sockfd,MSG* msg);


#endif